<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        #all{
            height: 340px;
            width: 790px;
            margin: 100px auto;
            position: relative;
        }
        #all li{
            display: none;
            position: absolute;
        }
        #all li:first-child{
            display: block;
        }
        #little{
            display: none;
        }
        #all:hover #little{
            display: block;
        }
        #little-left{

            font-family: "SimSun", "宋体";
            width: 30px;
            height: 60px;
            background-color: rgba(0, 0, 0, 0.1);
            position: absolute;
            top: 50%;
            margin-top: -30px;
            cursor: pointer;
            text-align: center;
            line-height: 60px;
            color: #fff;
            font-weight: 700;
            font-size: 30px;
        }

        #little-right{
            font-family: "SimSun", "宋体";
            width: 30px;
            height: 60px;
            background-color: rgba(0, 0, 0, 0.1);
            position: absolute;
            top: 50%;
            margin-top: -30px;
            cursor: pointer;
            text-align: center;
            line-height: 60px;
            color: #fff;
            font-weight: 700;
            font-size: 30px;
        }
        #little-left:hover{
            background-color: rgba(0, 0, 0, .5);
        }
        #little-right:hover{
            background-color: rgba(0, 0, 0, .5);
        }
        #little-left{
            left: 0;
        }
        #little-right{
           right: 0;
        }
    </style>
    <script>
        $(function () {

            var add = 0;

            $("#little-right").click(function () {
                add++;


                if(add == $("#all li").length){
                    add = 0;
                }
                console.log(add);

                $("#all li").eq(add).fadeIn().siblings("li").fadeOut();
            });

            $("#little-left").click(function () {
                add--;

                if(add == -1){
                    add = $("#all li").length - 1;
                }
                console.log(add);

                $("#all li").eq(add).fadeIn().siblings("li").fadeOut();
            })

        });



    </script>
</head>
<body>
<div id="all">
    <ul>
        <li style="display: none;"><a href="#"><img src="images/1.jpg" alt=""></a></li>
        <li style="display: none;"><a href="#"><img src="images/2.jpg" alt=""></a></li>
        <li style="display: none;"><a href="#"><img src="images/3.jpg" alt=""></a></li>
        <li style="display: none;"><a href="#"><img src="images/4.jpg" alt=""></a></li>
        <li style="display: none;"><a href="#"><img src="images/5.jpg" alt=""></a></li>
        <li style="display: none;"><a href="#"><img src="images/6.jpg" alt=""></a></li>
        <li style="display: block;"><a href="#"><img src="images/7.jpg" alt=""></a></li>
        <li><a href="#"><img src="images/8.jpg" alt=""></a></li>
    </ul>

    <div id="little">
        <span id="little-left">&lt;</span>
        <span id="little-right">&gt;</span>
    </div>
</div>
</body>
</html>